<?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Login extends CI_Controller {

    function index() {
        $this->load->database();
        $usuario = $_POST['usuario'];
        $constrasena = $_POST['contrasena'];
        $querySelect = "SELECT * FROM usuarios WHERE usuario = '$usuario' AND clave = MD5($constrasena)";
        $loginArray = $this->db->query($querySelect);
        $isAutenticate = false;
        foreach ($loginArray->result() as $itemLogin) {
            $isAutenticate = true;
        }
        if($isAutenticate)
            echo json_encode("true");
        else {
            echo json_encode("false");
        }
    }

}

?>